﻿<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="java.util.Map,java.util.HashMap" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="java.io.PrintWriter" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.general.BaseBean" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<jsp:useBean id="bb" class="weaver.general.BaseBean" scope="page" />
<%!
/**
 * 
 * @Title: getFormFieldMap
 * @Description: TODO(根据表单id和明细表序号[从1开始计算明细表]获取字段列表)
 * @param @param formid
 * @param @param num
 * @param @return 设定文件
 * @return Map<String,String> 返回类型
 * @throws
 */
public Map<String, String> getFormFieldMap(int formid, String num) {
	Map<String, String> array = new HashMap<String, String>();
	RecordSet rs = new RecordSet();
	formid = Math.abs(formid);
	String sql = "";
	sql = "select tablename from workflow_bill where id=-"+formid;
	rs.execute(sql);
	if(rs.next()){
		String tablename = Util.null2String(rs.getString("tablename")).toLowerCase();
		if ("0".equals(num)) {
			sql = "select b.id,b.fieldname,b.detailtable from workflow_billfield b where b.billid=-"+ formid+ " and (b.detailtable = '' or b.detailtable is null) ";
		} else {
			sql = "select b.id,b.fieldname,b.detailtable from workflow_billfield b where b.billid=-"+ formid+ " and b.detailtable='"+tablename+"_dt" + num + "'";
		}
		rs.execute(sql);
		while (rs.next()) {
			array.put(Util.null2String(rs.getString("fieldname")).toLowerCase(),Util.null2String(rs.getString("id")));
		}
	}
	return array;
}
%>
<%
User user = HrmUserVarify.getUser (request , response) ;
if(user == null)  return ;
/**
String isIE = (String)session.getAttribute("browser_isie");
if (isIE == null || "".equals(isIE)) {
	isIE = "true";
	session.setAttribute("browser_isie", "true");
}
**/
int type = Util.getIntValue(request.getParameter("type"));//0：查看；1：创建；2：编辑；3：监控
int formmodeid = Util.getIntValue(request.getParameter("formmodeid"));//模块id
String billid = Util.null2String(request.getParameter("billid"));//数据id
int formid = Util.getIntValue(request.getParameter("formid"));//表单id
String url = Util.null2String(request.getParameter("url"));//请求url串

int resourceId = user.getUID();//当前用户的id

%>
<%-- 获取表单字段map的代码段 2016-4-19 12:15:56 start --%>
<%

Map<String, String> arrayM = new HashMap<String, String>();
arrayM = getFormFieldMap(formid, "0");//主表字段map<name,id>

%>
<%-- 获取表单字段map的代码段 2016-4-19 12:15:56 start --%>
<%
/**此处可以编写自己的自定义java代码***/
RecordSet rs1 = new RecordSet();
String idCard = request.getParameter("sfzh");
String sql = "select * from formtable_main_7 where sfzh=" + idCard;
rs1.execute(sql);
String sfzh = "";
if(rs1.next()){
	sfzh = rs1.getString("sfzh");
}

PrintWriter pw = response.getWriter();
pw.write(sfzh);
pw.flush();
pw.close();

%>